<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>冒泡阶段和捕获阶段</title>
    <style>
        #level1{
            width:200px;
            height: 200px;
            border:1px solid #ccc;
        }
        #level2{
            margin-top:20px;
            margin-left:50px;
            cursor:pointer;
            background-color:yellow;
            width:50px;
        }
    </style>
</head>
<body>
    <div id="level1">
        <div id="level2">测试</div>
    </div>
</body>
</html>
<script>
    document.getElementById("level1").addEventListener('click',()=>{
        console.log("点击了level1");
    },false);
    document.getElementById("level2").addEventListener('click',()=>{
        console.log("点击了level2");
    },false);
    document.getElementById("level2").addEventListener('click',()=>{
        console.log("又点击了level2");
    },false);
    window.addEventListener("click",()=>{
        console.log("点击了windows");
    },false);
</script>
